Skip to content

Fix flaky test - #3231

Merged
martincostello merged 1 commit into
mainfrom
fix-flaky-test
Sep 12, 2026
Merged

martincostello merged 1 commit into
mainfrom
fix-flaky-test

Conversation

@martincostello

@martincostello martincostello commented Sep 12, 2026

Copy link
Copy Markdown
Member

Fix flaky test if there's a race in the shared pool between parallel test executions.

Fix flaky test if there's a race in the shared pool between parallel test executions.
@martincostello
martincostello marked this pull request as ready for review September 12, 2026 10:45
Copilot AI lite review requested due to automatic review settings September 12, 2026 10:45
@martincostello
martincostello enabled auto-merge (squash) September 12, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The FakeTimeProvider assertion will fail deterministically on .NET 8+ until corrected.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This pull request isolates cancellation-token pool tests from the shared process-wide pool to prevent race-related flakiness.

Changes:

  • Uses a dedicated pool for reusable-pool tests.
  • Exposes the pooled implementation internally for testing.
  • The FakeTimeProvider reuse assertion still needs correction.
File summaries
File Summary
test/Polly.Core.Tests/Utils/CancellationTokenSourcePoolTests.cs Uses an isolated pool but contains an incorrect reuse assertion on pooled targets.
src/Polly.Core/Utils/CancellationTokenSourcePool.Pooled.cs Enables internal construction of the pooled implementation for tests.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/Polly.Core.Tests/Utils/CancellationTokenSourcePoolTests.cs
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.02%. Comparing base (5f9fa58) to head (8a1dbab).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3231   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files         321      321           
  Lines        7099     7099           
  Branches     1089     1089           
=======================================
  Hits         6959     6959           
  Misses         98       98           
  Partials       42       42           
Flag Coverage Δ
linux 97.97% <ø> (-0.05%) ⬇️
macos 98.01% <ø> (ø)
windows 98.02% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@martincostello
martincostello merged commit 9ad5ae9 into main Sep 12, 2026
29 checks passed
@martincostello
martincostello deleted the fix-flaky-test branch September 12, 2026 10:56
This was referenced Sep 14, 2026
This was referenced Sep 15, 2026
IhateTrains pushed a commit to ParadoxGameConverters/ImperatorToCK3 that referenced this pull request Sep 16, 2026
Updated [Polly](https://github.com/App-vNext/Polly) from 8.7.0 to 8.8.0.

<details>
<summary>Release notes</summary>

_Sourced from [Polly's
releases](https://github.com/App-vNext/Polly/releases)._

## 8.8.0

## Highlights

* Add `EnableReloadsWithMonitor()` accepting custom `IOptionsMonitor` by
@​arashzjahangiri in App-vNext/Polly#3140
* Return null from `FaultGenerator` when no fault is generated by
@​dualfroz in App-vNext/Polly#3220

## What's Changed

* Update workflow timeout by @​martincostello in
App-vNext/Polly#3106
* Set `SOURCE_DATE_EPOCH` by @​martincostello in
App-vNext/Polly#3115
* Use `NUGET_API_KEY` by @​martincostello in
App-vNext/Polly#3116
* Test refactoring by @​martincostello in
App-vNext/Polly#3132
* Avoid test flakiness by @​martincostello in
App-vNext/Polly#3134
* Group github/codeql-action updates by @​martincostello in
App-vNext/Polly#3147
* Fix wrong word in hedging documentation by @​latent-9 in
App-vNext/Polly#3191
* OSMF sponsorship notice by @​joelhulen in
App-vNext/Polly#3194
* Fix XML doc comment on `PipelineExecutedArguments` by @​JiuYue0820 in
App-vNext/Polly#3201
* Update to xunit v3 by @​martincostello in
App-vNext/Polly#3131
* .NET 11 preparation by @​martincostello in
App-vNext/Polly#3225
* Fix flaky test by @​martincostello in
App-vNext/Polly#3231

## New Contributors

* @​arashzjahangiri made their first contribution in
App-vNext/Polly#3140
* @​latent-9 made their first contribution in
App-vNext/Polly#3191
* @​JiuYue0820 made their first contribution in
App-vNext/Polly#3201
* @​dualfroz made their first contribution in
App-vNext/Polly#3220

**Full Changelog**:
App-vNext/Polly@8.7.0...8.8.0


Commits viewable in [compare
view](App-vNext/Polly@8.7.0...8.8.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Polly&package-manager=nuget&previous-version=8.7.0&new-version=8.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants